/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gob.inamhi.entidades;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author dhinojosa
 */
@Entity
@Table(name = "empr", schema="administrative")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Empr.findAll", query = "SELECT e FROM Empr e"),
    @NamedQuery(name = "Empr.findByEmprId", query = "SELECT e FROM Empr e WHERE e.emprId = :emprId"),
    @NamedQuery(name = "Empr.findByEmprnomb", query = "SELECT e FROM Empr e WHERE e.emprnomb = :emprnomb"),
    @NamedQuery(name = "Empr.findByEmprdesc", query = "SELECT e FROM Empr e WHERE e.emprdesc = :emprdesc"),
    @NamedQuery(name = "Empr.findByEmpruing", query = "SELECT e FROM Empr e WHERE e.empruing = :empruing"),
    @NamedQuery(name = "Empr.findByEmprfing", query = "SELECT e FROM Empr e WHERE e.emprfing = :emprfing"),
    @NamedQuery(name = "Empr.findByEmprumod", query = "SELECT e FROM Empr e WHERE e.emprumod = :emprumod"),
    @NamedQuery(name = "Empr.findByEmprfmod", query = "SELECT e FROM Empr e WHERE e.emprfmod = :emprfmod")})
public class Empr implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "empr__id")
    private Integer emprId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 80)
    @Column(name = "emprnomb")
    private String emprnomb;
    @Size(max = 160)
    @Column(name = "emprdesc")
    private String emprdesc;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "empruing")
    private String empruing;
    @Basic(optional = false)
    @NotNull
    @Column(name = "emprfing")
    @Temporal(TemporalType.TIMESTAMP)
    private Date emprfing;
    @Size(max = 20)
    @Column(name = "emprumod")
    private String emprumod;
    @Column(name = "emprfmod")
    @Temporal(TemporalType.TIMESTAMP)
    private Date emprfmod;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "emprId")
    private Collection<Metr> metrCollection;

    public Empr() {
    }

    public Empr(Integer emprId) {
        this.emprId = emprId;
    }

    public Empr(Integer emprId, String emprnomb, String empruing, Date emprfing) {
        this.emprId = emprId;
        this.emprnomb = emprnomb;
        this.empruing = empruing;
        this.emprfing = emprfing;
    }

    public Integer getEmprId() {
        return emprId;
    }

    public void setEmprId(Integer emprId) {
        this.emprId = emprId;
    }

    public String getEmprnomb() {
        return emprnomb;
    }

    public void setEmprnomb(String emprnomb) {
        this.emprnomb = emprnomb;
    }

    public String getEmprdesc() {
        return emprdesc;
    }

    public void setEmprdesc(String emprdesc) {
        this.emprdesc = emprdesc;
    }

    public String getEmpruing() {
        return empruing;
    }

    public void setEmpruing(String empruing) {
        this.empruing = empruing;
    }

    public Date getEmprfing() {
        return emprfing;
    }

    public void setEmprfing(Date emprfing) {
        this.emprfing = emprfing;
    }

    public String getEmprumod() {
        return emprumod;
    }

    public void setEmprumod(String emprumod) {
        this.emprumod = emprumod;
    }

    public Date getEmprfmod() {
        return emprfmod;
    }

    public void setEmprfmod(Date emprfmod) {
        this.emprfmod = emprfmod;
    }

    @XmlTransient
    public Collection<Metr> getMetrCollection() {
        return metrCollection;
    }

    public void setMetrCollection(Collection<Metr> metrCollection) {
        this.metrCollection = metrCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (emprId != null ? emprId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Empr)) {
            return false;
        }
        Empr other = (Empr) object;
        if ((this.emprId == null && other.emprId != null) || (this.emprId != null && !this.emprId.equals(other.emprId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gob.inamhi.entidades.Empr[ emprId=" + emprId + " ]";
    }
    
}
